<template>
  <div class="recruit_index">
    <van-sticky>
      <van-nav-bar title="人才招聘" v-if="!flag" left-arrow @click-left="back">
        <template #right>
          <van-icon name="share" size="18" @click='sharefun' />
        </template>
      </van-nav-bar>
        <van-nav-bar title="人才招聘" v-if="flag" left-arrow @click-left="gohome">
        <template #right>
          <van-icon name="share" size="18" @click='sharefun' />
        </template>
      </van-nav-bar>
    </van-sticky>

    <div class="company">
      <h4 class="name">{{detail.entName}}</h4>
      <div class="infor flex">
        <div class="logo">
          <img :src="detail.logoUrl" style="width: 100%; height: 100%;" alt="">
        </div>
        <div class="desc">
          <div class="tags flex">
            <span class="type1 row-between-center"><i class="icon"></i>{{detail.levelName}}</span>
            <!-- <span class="type2"> 政府机关</span> -->
            <span class="type2">{{detail.industryTypeCN}}</span>
          </div>
          <div class="address flex">
            <i class="icon_address"></i>
            <span class="text">{{detail.regionName}}</span>
          </div>
        </div>

      </div>
    </div>

    <van-tabs v-model="active">
      <van-tab title="公司简介">
        <div class="intrduce">
          <p v-html="detail.introduction">当当是知名的综合性网上购物商城，由国内著名出版机构科文公司、美国老虎基金、美国IDG集团、卢森堡剑桥集团、亚洲创业投资基金（原名软银中国创业基金）共同投资成立。</p>
        </div>
      </van-tab>
      <van-tab title="职位">
        <div class="job">
          <router-link tag="div" :to="{path:`/jobDetail/${item.id}`}" class="list van-hairline--bottom" v-for="(item,index) in jobList" :key="index">
            <div class="left">
              <h4 class="name">{{item.jobName}}</h4>
              <div class="tags flex">
                <span class="tag">{{item.workingLifeCN}}</span>
                <span class="tag">{{item.degreeCN}}</span>
              </div>
            </div>
            <div class="price">{{item.salaryTypeCN}}</div>
          </router-link>
        </div>
      </van-tab>
    </van-tabs>
    <share-yellow v-if="showShare" :detail="detail" @close="close"></share-yellow>
  </div>
</template>

<script>
import api from 'api/api'
export default {
  data () {
    return {
      active: 0,
      detail: {},
      jobList: [],
      showShare: false,
      flag:""
    }
  },
  created () {
      var str = window.location.href
      this.flag = str.search('share=') != -1
    this.getData()

  },
  methods: {
    getData () {
      api.jobCompany({
        data: {
          id: this.$route.params.id
        }
      }).then(res => {
        this.detail = res.data
      })
      api.jobCompanyList({
        data: {
          entId: this.$route.params.id
        }
      }).then(res => {
        this.jobList = res.data.records
      })
    },
    back () {
      window.history.go(-1)
    },
    gohome () {
      this.$router.push('/')
    },
    sharefun () {
      this.showShare = true
    },
    close () {
      this.showShare = false
    }
  }
}
</script>

<style lang="scss">
.recruit_index {
  background-color: #fff;
  min-height: 100vh;
  .van-tabs__line {
    background-color: #348aff;
  }
  .company {
    padding: 0.27rem 0.27rem 0.41rem 0.27rem;
    background-color: #fff;
    margin-bottom: 0.17rem;
    position: relative;
    text-align: left;
    .name {
      font-size: 0.37rem;
    }
    .logo {
      width: 1rem;
      height: 1rem;
      background-image: url("../../../assets/img/home/logo .png");
      background-size: cover;
    }
    .infor {
      text-align: left;
      flex: auto;
      margin-top: 0.25rem;
      .desc {
        margin-left: 0.2rem;
      }
      .tags {
        span {
          margin-right: 0.21rem;
          padding: 0.03rem 0.2rem;
        }
        .type1 {
          background: rgba(255, 241, 231, 1);
          border-radius: 0.07rem;
          color: #ff8a34;
          font-size: 0.22rem;
          .icon {
            width: 0.2rem;
            height: 0.23rem;
            background: url("../../../assets/img/home/renzheng .png");
            background-size: contain;
            background-repeat: no-repeat;
            background-position: center;
            margin-right: 0.05rem;
          }
        }
        .type2 {
          background: rgba(239, 246, 255, 1);
          border-radius: 7px;
          color: #348aff;
          font-size: 0.22rem;
          // padding: 0.1rem;
        }
      }
      .address {
        align-items: center;
        margin-top: 0.2rem;
        .icon_address {
          width: 0.27rem;
          height: 0.24rem;
          background: url("../../../assets/img/home/map.png");
          background-size: contain;
          background-repeat: no-repeat;
          background-position: center;
          margin-right: 0.1rem;
        }
        .text {
          font-size: 0.22rem;
        }
      }
    }
    .hot {
      font-size: 0.22rem;
      padding-top: 0.1rem;
      margin-top: 0.1rem;
      strong {
        color: #348aff;
        font-weight: 400;
      }
    }
  }
  .intrduce {
    font-size: 0.3rem;
    padding: 0.35rem 0.53rem;
    text-align: left;
    background-color: #fff;
    p {
      margin-bottom: 0.34rem;
    }
  }
  .job {
    text-align: left;
    padding: 0.3rem;
    background-color: #fff;
    .list {
      display: flex;
      justify-content: space-between;
      padding: 0.4rem 0;
      .left {
        .name {
          font-size: 0.32rem;
          margin-bottom: 0.2rem;
        }
        .tag {
          padding: 0.02rem 0.2rem;
          border-radius: 0.07rem;
          background-color: #f3f4f5;
          color: #666;
          font-size: 0.22rem;
          margin-right: 0.2rem;
        }
      }
      .price {
        font-size: 0.32rem;
        color: #ff344c;
      }
    }
  }
}
</style>